<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/fmt" prefix="fmt" %>
<%@ taglib uri="/tags/core" prefix="c" %>


<% 
response.setHeader( "Expires", "Sat, 6 May 1995 12:00:00 GMT" );
response.setHeader( "Cache-Control", "no-store, no-cache, must-revalidate" );
response.addHeader( "Cache-Control", "post-check=0, pre-check=0" );
response.setHeader( "Pragma", "no-cache" );
%>
<fmt:setLocale value="${LANGUAGE_SESSION}" scope="session"/>
<fmt:setBundle basename="messages"/>

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html	; charset=iso-8859-1" />
		<link rel="stylesheet" href="css/principal.css" type="text/css">
		<link rel="stylesheet" href="css/calendar.css" type="text/css">
		<link rel="stylesheet" href="css/secundario.css" type="text/css">
		<title><bean:message key="application.title"/></title>
		<script type="text/javascript" src="js/tooltip.js"></script>
		<script type="text/javascript" src="js/menu/milonic_src.js"></script>	
		<script type="text/javascript" src="js/menu/mmenudom.js"></script>
		<script type="text/javascript" src="js/menu/menu_data.js"></script>
		<script type="text/javascript" src="js/utils.js"></script>
		<script type="text/javascript" src="js/Ajax.js"></script>
		<script type="text/javascript">
		var submitCount = 0;
		var processingRequestMessage = replaceCharacterEntities('<fmt:message key="warning.message.common.processing"/>');
		function confirmDelete(code){
			if( confirm('<bean:message key="label.plants.del.message"/> ' + code + '?') ){
				return true;
			}else{
				return false;
			}
		}
		function cleanNumber(field){
			if( field.value == 0 ){
				field.value = '';
			}
		}
		function decimales(Numero, Decimales) {
			pot = Math.pow(10,Decimales);
			num = parseInt(Numero * pot) / pot;
			nume = num.toString().split('.');
			var i = 0;
			if(nume.length==1) {
			  var deci='';
			  for(i=0;i<Decimales;i++)
			    deci+=String.fromCharCode(48);
			  if( Decimales > 0 ){
			  	num=nume+'.'+deci;
			  }
			}else{
				if( nume[1].length < Decimales){
					var deci='';
					for(i=nume[1].length;i<Decimales;i++)
					    deci+=String.fromCharCode(48);
					num = num+deci;
				}
			}
			return num;
		}
		function cleanDecimals(field){
			field.value = decimales( field.value, 0 );
		}
		function focusLogin(){
			var userid = document.getElementById("userView.usrId");
			if( userid != undefined ){
				userid.focus();
			}
		}
		</script>
	</head>
    <body onload="focusLogin();">
		<table width="978" height="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="gray">
			<tr>
				<td bgcolor="white">
					<table width="978" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
						<tr>
							<td>
								<tiles:insert attribute="menu"/>
								<br/>
							</td>
						</tr>
						<tr>
							<td height="100%" align="center" valign="top" style="color: #FFFFFF">
								<logic:present name="BREADCRUMBS">
									<p align="left" class="infomessage">&nbsp;&nbsp;
									<logic:present name="BREADCRUMBS">
										<c:forEach items="${BREADCRUMBS}" var="breadcrumb">
											<a class="breadcrumb_link " href='<c:out value="${breadcrumb.url}" />'><fmt:message key="${breadcrumb.label}"/>
												<logic:present name="breadcrumb" property="sessionValue"> 
													<bean:define id="sessionValue" name="breadcrumb" property="sessionValue"></bean:define><%=session.getAttribute((String)sessionValue)%>
												</logic:present>
											</a>
											<label><img height="8px" src="images/breadcrumbIcon.gif" /></label>																									
										</c:forEach>
										<label class="breadcrumb_label"><fmt:message key="${BREADCRUMB_LABEL}"/></label>
									</logic:present>	
										<% session.removeAttribute("BREADCRUMBS"); %>
									</p>
								</logic:present>
								<logic:present name="ERROR_MESSAGE">
									<p align="center" class="errortext">
										<bean:write name="ERROR_MESSAGE"  scope="session"/>
										<% session.removeAttribute("ERROR_MESSAGE");%>
									</p>
								</logic:present>
								<logic:present name="MESSAGE">
									<p align="center" class="infomessage">
										<bean:write name="MESSAGE"/>
										<% session.removeAttribute("MESSAGE"); %>
									</p>
								</logic:present>
								<logic:present name="ERROR_MESSAGE_LIST">
									<p align="center" class="errortext">
										<c:forEach items="${ERROR_MESSAGE_LIST}" var="error">
											<c:out value="${error}" /><br/>
										</c:forEach>	
										<% session.removeAttribute("ERROR_MESSAGE_LIST");%>
									</p>
								</logic:present>
								<logic:present name="MESSAGE_LIST">
									<p align="center" class="infomessage">
										<c:forEach items="${MESSAGE_LIST}" var="message">
											<c:out value="${message}" /><br/>
										</c:forEach>	
										<% session.removeAttribute("MESSAGE_LIST");%>
									</p>
								</logic:present>
								<tiles:insert attribute="body"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td height="6%" class="nota" align="center" bgcolor="white">
					<tiles:insert attribute="footer"/>
				</td>
			</tr>
		</table> 
    </body>
</html>
